pkgname=ndctl
pkgver=git
pkgrel=1
arch=('i386' 'x86_64')
url="https://github.com/pmem/ndctl"
license=('GPL')
makedepends_debian_11=(pkg-config libkmod-dev uuid-dev libjson-c-dev udev libudev-dev libudev1 bash-completion libkeyutils-dev meson asciidoctor libiniparser-dev)
source=("https://gitee.com/ssri-mirrors/ndctl.git" "https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git" "https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git")
md5sums=('SKIP' 'SKIP' 'SKIP')

build() {

	if [ "$os" == "debian" ];then
		mkdir -p /lkp/benchmarks/include
		[[ -e '/lkp/benchmarks/include/iniparser.h' ]] || cp /usr/include/iniparser/* /lkp/benchmarks/include/
		cd $srcdir/libtraceevent/
		make && make install
        cd $srcdir/libtracefs/
		make && make install
	fi

	cd "$srcdir/${pkgname}"
	meson setup build
	meson configure -Dtest=enabled -Ddocs=disabled -Drootprefix=/lkp/benchmarks -Dprefix=/lkp/benchmarks build
	meson compile -C build
}

package() {
	cd "$srcdir/${pkgname}"
	DESTDIR="${pkgdir}" meson install -C build
}
